use clap::{command, Parser};

mod agent;
mod modifymsg;
mod myserver;
mod rpc_server;

/// Command-line arguments
#[derive(Parser, Debug)]
#[command(
    name = "configmonitor_server",
    version = "1.0",
    author = "Zhenxiong Tian",
    about = "Server for monitoring configuration files"
)]
struct Args {
    /// 远程git仓库地址
    #[arg(short = 'u', long)]
    url: String,

    /// 临时文件存放路径
    #[arg(short = 'p', long)]
    path: String,

    /// The RPC server address
    #[arg(short = 'r', long)]
    rpc_server_addr: String,
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let args = Args::parse();
    myserver::MyServer::new(args.url, args.path, args.rpc_server_addr)
        .run()
        .await?;
    Ok(())
}
